<extend name="Public/base" />
<block name="main">
    <fieldset class="layui-elem-field">
        <legend>权限管理 - 权限组成员列表</legend>
        <div class="layui-field-box">
            <table class="layui-table" lay-even>
                <thead>
                <tr>
                    <th>#</th>
                    <th>用户账号</th>
                    <th>用户昵称</th>
                    <th>登录次数</th>
                    <th>最后登录时间</th>
                    <th>最后登录IP</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <volist name="list" id="vo">
                    <tr>
                        <td>{$i}</td>
                        <td>{$vo['username']}</td>
                        <td>{$vo['nickname']}</td>
                        <td>{:intval($vo['loginTimes'])}</td>
                        <td>{:(empty($vo['lastLoginTime'])?'该用户未曾登录过':date('Y-m-d H:i:s', $vo['lastLoginTime']))}</td>
                        <td>{:(empty($vo['lastLoginIp'])?'该用户未曾登录过':long2ip($vo['lastLoginIp']))}</td>
                        <td>
                            <if condition="$vo['status']">
                                <span style="border-radius: 2px;background-color: #5FB878;padding:5px 10px;color: #ffffff">启用</span>
                                <else />
                                <span style="border-radius: 2px;background-color: #FF5722;padding:5px 10px;color: #ffffff">禁用</span>
                            </if>
                        </td>
                        <td>
                            <span class="layui-btn layui-btn-danger confirm" data-uid="{$vo['uid']}" data-info="你确定踢出当前用户么？" data-url="{:U('delMember')}">删除</span>
                        </td>
                    </tr>
                </volist>
                </tbody>
            </table>
        </div>
    </fieldset>
</block>
<block name="myScript">
    <script>
        layui.use(['layer'], function() {
            $('.confirm').on('click', function () {
                var ownObj = $(this);
                layer.confirm(ownObj.attr('data-info'), {
                    btn: ['确定','取消'] //按钮
                }, function(){
                    $.ajax({
                        type: "POST",
                        url: ownObj.attr('data-url'),
                        data: {uid:ownObj.attr('data-uid'),groupId:{:I("get.group_id")}},
                        success: function(msg){
                            if( msg.code == 1 ){
                                location.reload();
                            }else{
                                layer.msg(msg.msg, {
                                    icon: 5,
                                    shade: [0.6, '#393D49'],
                                    time:1500
                                });
                            }
                        }
                    });
                });
            });
        });
    </script>
</block>